#pragma once 
#include "tinyrpc/base/noncopyable.h"
#include "epoller.h"
#include <memory>
#include <vector>
#include <mutex>
#include "eventloop.h"
#include "tinyrpc/base/thread.h"
#include <semaphore.h>
namespace TinyRPC
{
class Task;
class Event;

class EventLoopThread : public Noncopyable {
public:
    EventLoopThread();
    EventLoop* start();
    void join(){
        m_thread.join();
    }
    void quit(){
        m_loop->quit();
        m_thread.join();
    }
private:
    void threadFunc();
private:
    Thread m_thread;
    EventLoop* m_loop;
    sem_t m_eventLoopInitSem;
};  

} // namespace TinyRPC

